<?php
if($this->ma == 1){
    echo '<script language="javascript" type="text/javascript">alert("渠道商添加成功！");</script>';
} else if($this->ma === 0) {
    echo '<script language="javascript" type="text/javascript">alert("渠道商添加失败！");</script>';
}else if($this->ma == 2){
    echo '<script language="javascript" type="text/javascript">alert("该渠道已经存在！");</script>';
}
?>
<div class="admin_nrtop">
    <div class="ad_search">
        <form action="/admini/cnship/index"  method="get" style="margin:0px" id="form1">
        <div class="search">
            <div class="soubox">
                <input type="text" id="quick" name="quick" value="<?php echo $this->quick?$this->quick:"";?>" placeholder="输入物流名称"/>
            </div>
            <a href="javascript:$('#form1').submit();"><span>搜索</span></a>
        </div>
        </form>
    </div>
</div>
<div  class="biaoge">
    <div class="biaotbody">
        <table>
            <tr>
                <th class="li3"><div class="lileft">&nbsp;</div></th>
                <th class="li30">
                    <div class="lileft"><span>物流名称</span></div>
                </th>
                <th class="li5">
                    <div class="lileft"><span>首字母</span></div>
                </th>
                <th class="li5">
                    <div class="lileft"><span>编码</span></div>
                </th>
                <th class="li5">
                    <div class="lileft"><span>添加时间</span></div>
                </th>
                <th class="li5">
                    <div class="lileft"><span>操作</span></div>
                </th>
            </tr>
        </table>
    </div>
    <?php if(($this->isDisable !== "" && $this->isDisable !== null)){?>
            <div class="xzinfo">
            	<ul>
                    <?php if($this->isDisable === "" && $this->isDisable !== null){}else{ ?><li><div class="xzinfobox"><span><?php echo $this->isDisable==1?"禁用":"正常";?></span><a href="javascript:removeset('isDisable')" title="撤销"><i>撤销</i></a></div></li><?php }?>
                </ul>
            </div>
     <?php }?>
     <div class="table" style='margin-top:0px;'>
         <table>
             <?php  if($this->cnshiplists){
                foreach ($this->cnshiplists as $Item) { ?> 
                 <tr id="tr_<?php echo $Item->id;?>">
                     <td class="li3">&nbsp;</td>
                     <td class="li30">
                         <div class="lileft">
                             <span><a href="/admini/cnship/shipdetail/id/<?php echo $Item->Id;?>" class="indexa"><?php echo $Item->Name;?></a></span>
                         </div>
                     </td>  
                     <td class="li5">
                         <div class="lileft">
                             <span><?php echo $Item->word?$Item->word:"暂无";?></span>
                         </div>
                     </td>  
                     <td class="li5">
                         <div class="lileft">
                             <?php echo $Item->code?$Item->code:"暂无";?>
                         </div>
                     </td>     
                     <td class="li5">
                         <div class="lileft">
                             <?php echo $Item->createdAt ? $Item->createdAt : "";?>
                         </div>
                     </td> 
                     <td class="li5">
                         <div class="lixlnav">
                             <a class="xlnavxq" href="/admini/cnship/shipdetail/id/<?php echo $Item->Id;?>/isEdit/1" name="<?php echo $Item->Id;?>">编辑</a>
                         </div>
                     </td>
                 </tr>
             <?php } }  if(!$this->cnshiplists){
                echo "<font size='4' color='red'>暂无数据</font>";
                }?>   
         </table>
     </div>
 </div>
<div class="toolbar">
    <div class="qunx">
        <ul>
            <li><a class="anvbotton" href="javascript:void(0)" id="addCp" name="addCp"><span>添加物流</span></a></li>
        </ul>
    </div>
<?php
    echo $this->partial('paging.phtml', array("pages" => $this->cnshiplistsAll,"pamas"=>"quick=$this->quick&isDisable=$this->disabled"));        
?>
</div>
<style>
    #add_table{
        width: 540px;
        font-size: 16px;
        padding: 5px;
    }
    #add_table *{
        font-size: 14px;
        padding: 5px;
    }
</style>
<div class="tanchuang" style="display:none;">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd" id="wayProblem">添加物流</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wenti_box" id="problemComm">
            <div style="margin-left:10px;margin-top: 15px;margin-bottom: 5px;">
                <form action="/admini/cnship/add" id="form_add" method="post">
                <table id="add_table">
                    <tr>
                        <td align="center" colspan="4" style="font-size:18px" class="taskTitle">添加渠道商</td>
                    </tr>
                    <tr>
                        <td align="right">物流名称：</td>
                        <td><input type="text" id="name" name="name" value="" style="width:300px;"/></td>
                    </tr>
                    <tr>
                        <td align="right">编码：</td>
                        <td><input type="text" id="code" name="code" value="" style="width:100px;"/></td>
                    </tr>
                    <tr>
                        <td align="right">首字母：</td>
                        <td><input type="text" id="code" name="word" value="" style="width:100px;"/></td>
                    </tr>
                    <tr>
                        <td align="right">说明：</td>
                        <td colspan="3"><textarea id="comment" name="comment" style="margin: 0px;height: 80px;width: 310px;"></textarea></td>
                    </tr>
                    <tr>
                        <td align="center"  colspan="4">
                            <input type="button" id="CPAdd" name="CPAdd" value="添加" style="background-color: #F60;width: 50px;height: 36px;color: white;font-size: 16px;border-radius:8px;"/>
                            &nbsp;&nbsp;<input type="button" id="refo" naem="refo" value="返回" style="background-color: #1668A4;width: 50px;height: 36px;color: white;font-size: 16px;border-radius:8px;"/>
                        </td>
                    </tr>
                </table>
                </form>
            </div>
    </div>
</div>
<div class="houtai_overlay" style="display:none;"></div>
<script>
    $(".lixiala").click(function(){
        $(".lixiala").attr("class","lixiala");
        $(".lixiala").next("div").attr("style","display:none;");
    
        $(this).attr("class","lixiala bton");
        $(this).next("div").attr("style","display:block;");
    });
    $(document).bind("click",function(e){
        var target  = $(e.target);
        if(target.closest(".biaoxiala").length == 0){
            $(".lixiala").attr("class","lixiala");
            $(".lixiala").next("div").attr("style","display:none;");
        }
    });
    
    function setNameVal(Name,val)
    {
        $("#form1 #is"+Name).val(val);
        $("#form1").submit();
    }
    function removeset(set)
    {
        $("#form1 #"+set).val("");
        $("#form1").submit();
    }
    $(".xlnavsj").live("mousemove",function(){
        $(this).next("div").show();
    });
    $(".lixlnav").mouseleave(function(){
        $(".xlnavsj").next("div").hide();
    });
    
    
    $("#addCp").click(function(){
        $("div.tanchuang").show();
        $("div.houtai_overlay").show();
        //$("input[type=reset]").trigger("click");
    });
    $("#CPAdd").click(function(){
        var name = $("#name").val();
        if(name == ""){
            alert("渠道商名称不能为空");
            return false;
        }
        $("#form_add").submit();
    });
    $(".nui-msgbox-close").click(function(){
        $(".houtai_overlay").hide();
        $(".tanchuang").hide();
    });
    $("#refo").click(function(){
        $(".houtai_overlay").hide();
        $(".tanchuang").hide();
    });
</script>